<!--
 * @Author: 黄宇/Hyuishine
 * @Date: 2022-05-16 15:08:03
 * @LastEditors: 徐伟杰
 * @LastEditTime: 2022-10-21 16:19:56
 * @Description: 
 * @Email: hyuishine@gmail.com
 * @Company: 3xData
 * @youWant: 技术服务机构=>质量管理体系
-->

<template>
  <!-- 单位基本信息 -->
  <view class="collapsePane">
    <!-- 字段标题 -->
    <view class="title"
          @click="status = !status">
      质量管理体系
      <view :class="status ? 'cuIcon-unfold':'cuIcon-right'" />
    </view>

    <!-- 折叠中的内容 -->
    <view class="pane"
          :class="status ? 'unfold':'fold'">

      <!-- 表单字段内容 -->
      <view class="card_form scrollPane">

        <template v-for="formItem,i in formBuild">
          <!-- 单行表单项  -->
          <view class="formItem_doubleRow"
                :key="i">

            <!-- 字段标题 -->
            <view class="label"
                  :style="{width:formItem.width}">{{ formItem.label }}</view>

            <!-- 输入区域 -->
            <template>
              <encapsulation-preview v-if="formItem.type === 'image' && formItem.prop != null"
                                     :fileUrl="formItem.prop"></encapsulation-preview>
              <span v-if="formItem.prop == null">暂无数据</span>
            </template>
          </view>
        </template>
      </view>

    </view>
  </view>

</template>
<script>
import EncapsulationPreview from '../components/EncapsulationPreview.vue';
export default {
  name: 'qualityManage',
  components: { EncapsulationPreview },
  data () {
    return {
      status: false, // true为开启
      formBuild: [
        { label: '维护保养检测质量管理体系文件', prop: null, type: 'image', show: false },
        { label: '维护保养检测认证证书', prop: null, type: 'image', show: false },
        { label: '安全评估质量体系文件', prop: null, type: 'image', show: false },
        { label: '安全评估证书', prop: null, type: 'image', show: false },
      ],
      systemFiles: null, // 维护保养检测质量管理体系文件
    }
  },
  props: {
    form: {
      type: Object,
      default: () => { }
    }
  },
  created () {
    setTimeout(() => {
      console.log(this.form)
      if (this.form.serviceType.indexOf('1') != '-1') {
        this.formBuild[0].prop = this.form?.maintenance?.systemFiles || null
        this.formBuild[1].prop = this.form?.maintenance?.authFiles || null
        this.formBuild[0].show = true
        this.formBuild[1].show = true
      }
      if (this.form.serviceType.indexOf('2') != '-1') {
        this.formBuild[2].prop = this.form?.assessSafety?.systemFiles || null
        this.formBuild[3].prop = this.form?.assessSafety?.safetyCertificationFiles || null
        this.formBuild[2].show = true
        this.formBuild[3].show = true
      }
    }, 1000);
  }
}
</script>
<style lang="scss" scoped>
</style>